from enum import Enum


class VehicleType(Enum):
    PASSENGER_SHUTTLE_BUS = "旅客摆渡车"
    BAGGAGE_TRACTOR = "行李牵引车"
    AIRCRAFT_TRACTOR = "飞机牵引车"
    REFUELING_VEHICLE = "加油车"
    CATERING_VEHICLE = "食品供应车"
    POTABLE_WATER_VEHICLE = "清水车"
    SEWAGE_VEHICLE = "污水车"
    DE_ICING_VEHICLE = "除冰车"
    BIRD_SCARE_VEHICLE = "驱鸟车"
    FIRE_ENGINE = "消防车"
    SNOW_CLEARING_VEHICLE = "除雪车"
    RUNWAY_CLEANING_VEHICLE = "跑道清扫车"
    AMBULANCE = "急救车"
    AIRPORT_MAINTENANCE_VEHICLE = "机场维护车"
    ATC_EQUIPMENT_MAINTENANCE_VEHICLE = "空管设备维护车"
    POLICE_VEHICLE = "警车"
    BUS = "巴士"
    LAWN_MOWER_VEHICLE = "割草车"
    GUIDE_VEHICLE = "引导车"

    def __str__(self):
        """
        重写__str__方法，使得打印该枚举实例时能直接输出对应的中文名称
        """
        return self.value

    @classmethod
    def from_string(cls, vehicle_type_str):
        """
        根据传入的表示车辆类型的中文字符串获取对应的VehicleType枚举实例
        """
        for member in cls:
            if member.value == vehicle_type_str:
                return member
        raise ValueError(f"无效的车辆类型字符串: {vehicle_type_str}")

    @classmethod
    def get_all_vehicle_types(cls):
        """
        获取所有已定义的车辆类型枚举实例，返回一个列表
        """
        return list(cls)

if __name__ == "__main__":
    # 获取旅客摆渡车对应的枚举实例并打印
    vehicle_type = VehicleType.PASSENGER_SHUTTLE_BUS
    print(vehicle_type)  # 输出: 旅客摆渡车

    # 通过字符串获取对应的枚举实例
    input_str = "食品供应车"
    vehicle_type_from_str = VehicleType.from_string(input_str)
    print(vehicle_type_from_str)  # 输出: 食品供应车

    # 获取所有车辆类型的枚举实例列表并打印
    all_vehicle_types = VehicleType.get_all_vehicle_types()
    for v_type in all_vehicle_types:
        print(v_type)
